import env from '../env.js';

export function handleUrl(url) {
  return String(url||"").replace(/\/{2,}/g,'/')
}

export function getXhrUrl(url, agent) {
  if (agent === undefined) {
    agent = env.get('VUE_APP_API_BASE_URL');
  }
  return (env.DEV ? agent || '' : env.BASE_URL) + url;
}

export function getAgentUrl(url, agent) {
  if (agent === undefined) {
    agent = env.get('VUE_APP_API_BASE_URL');
  }
  return (env.DEV ? agent || '' : '') + url;
}
